package org.chen.spring.cloud.finchley.feign.controller;

import org.chen.spring.cloud.finchley.feign.service.GithubFeignService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author chensj
 * @date 2020-02-05 23:52
 */
@RestController
public class GithubFeignController {

    private final GithubFeignService githubFeignService;

    public GithubFeignController(GithubFeignService githubFeignService) {
        this.githubFeignService = githubFeignService;
    }

    /**
     * 查询Github项目信息
     * @param queryStr 仓库名称
     * @return 结果
     */
    @GetMapping(value = "/github/search")
    public String searchGithubRepoByStr(@RequestParam("str") String queryStr) {
        return githubFeignService.searchRepo(queryStr);
    }
}
